﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdRxRasterServices : OdRxModule
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdRxRasterServices(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdRxRasterServices_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdRxRasterServices obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdRxRasterServices()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdRxRasterServices(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdRxRasterServices cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_cast(OdRxObject.getCPtr(pObj));
			OdRxRasterServices result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxRasterServices)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxRasterServices)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxRasterServices)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdRxRasterServices_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdRxRasterServices_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdRxRasterServices_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxRasterServices createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_createObject();
			OdRxRasterServices result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxRasterServices)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxRasterServices)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxRasterServices)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiRasterImage loadRasterImage(string filename, uint[] pFlagsChain)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_loadRasterImage__SWIG_0(this.swigCPtr, filename, Helpers.MarshalUInt32FixedArray(pFlagsChain));
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiRasterImage loadRasterImage(string filename)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_loadRasterImage__SWIG_1(this.swigCPtr, filename);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiRasterImage loadRasterImage(OdStreamBuf pStreamBuf, uint[] pFlagsChain)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_loadRasterImage__SWIG_2(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf), Helpers.MarshalUInt32FixedArray(pFlagsChain));
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiRasterImage loadRasterImage(OdStreamBuf pStreamBuf)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_loadRasterImage__SWIG_3(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf));
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiRasterImage createRasterImage(IntPtr pImp)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdRxRasterServices_createRasterImage(this.swigCPtr, pImp);
			OdGiRasterImage result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiRasterImage)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool saveRasterImage(OdGiRasterImage rasterImage, string filename, uint[] pFlagsChain)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_saveRasterImage__SWIG_0(this.swigCPtr, OdGiRasterImage.getCPtr(rasterImage), filename, Helpers.MarshalUInt32FixedArray(pFlagsChain));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool saveRasterImage(OdGiRasterImage rasterImage, string filename)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_saveRasterImage__SWIG_1(this.swigCPtr, OdGiRasterImage.getCPtr(rasterImage), filename);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool saveRasterImage(OdGiRasterImage rasterImage, string filename, uint type, uint[] pFlagsChain)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_saveRasterImage__SWIG_2(this.swigCPtr, OdGiRasterImage.getCPtr(rasterImage), filename, type, Helpers.MarshalUInt32FixedArray(pFlagsChain));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool convertRasterImage(OdGiRasterImage pRaster, uint type, OdStreamBuf pStreamBuf, uint[] pFlagsChain)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_convertRasterImage__SWIG_0(this.swigCPtr, OdGiRasterImage.getCPtr(pRaster), type, OdStreamBuf.getCPtr(pStreamBuf), Helpers.MarshalUInt32FixedArray(pFlagsChain));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool convertRasterImage(OdGiRasterImage pRaster, uint type, OdStreamBuf pStreamBuf)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_convertRasterImage__SWIG_1(this.swigCPtr, OdGiRasterImage.getCPtr(pRaster), type, OdStreamBuf.getCPtr(pStreamBuf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool convertRasterImage(OdStreamBuf pSrcStream, OdStreamBuf pDstStream, uint type, uint[] pFlagsChainSrc, uint[] pFlagsChainDst)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_convertRasterImage__SWIG_2(this.swigCPtr, OdStreamBuf.getCPtr(pSrcStream), OdStreamBuf.getCPtr(pDstStream), type, Helpers.MarshalUInt32FixedArray(pFlagsChainSrc), Helpers.MarshalUInt32FixedArray(pFlagsChainDst));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool convertRasterImage(OdStreamBuf pSrcStream, OdStreamBuf pDstStream, uint type, uint[] pFlagsChainSrc)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_convertRasterImage__SWIG_3(this.swigCPtr, OdStreamBuf.getCPtr(pSrcStream), OdStreamBuf.getCPtr(pDstStream), type, Helpers.MarshalUInt32FixedArray(pFlagsChainSrc));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool convertRasterImage(OdStreamBuf pSrcStream, OdStreamBuf pDstStream, uint type)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_convertRasterImage__SWIG_4(this.swigCPtr, OdStreamBuf.getCPtr(pSrcStream), OdStreamBuf.getCPtr(pDstStream), type);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdUInt32Array getRasterImageTypes()
		{
			OdUInt32Array result = new OdUInt32Array(GlobalsPINVOKE.OdRxRasterServices_getRasterImageTypes(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool isRasterImageTypeSupported(uint type)
		{
			bool result = GlobalsPINVOKE.OdRxRasterServices_isRasterImageTypeSupported(this.swigCPtr, type);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string mapTypeToExtension(uint type, string psFilterName)
		{
			string result = GlobalsPINVOKE.OdRxRasterServices_mapTypeToExtension(this.swigCPtr, type, psFilterName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint mapExtensionToType(string extension)
		{
			uint result = GlobalsPINVOKE.OdRxRasterServices_mapExtensionToType(this.swigCPtr, extension);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint getImageFormat(string filename)
		{
			uint result = GlobalsPINVOKE.OdRxRasterServices_getImageFormat__SWIG_0(this.swigCPtr, filename);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint getImageFormat(OdStreamBuf pStreamBuf)
		{
			uint result = GlobalsPINVOKE.OdRxRasterServices_getImageFormat__SWIG_1(this.swigCPtr, OdStreamBuf.getCPtr(pStreamBuf));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
